<div class="search-input">
	<form class="form-inline" role="form" id="SearchForm" method="get" action="/search">
      	<div class="form-group">
			<input placeholder="Tìm kiếm" class="form-control search-text" name="searchText" type="text" 
					value="<?php if(!empty($searchText)){ echo $searchText; }; ?>"/>
		</div>
		<div class="form-group">
			<select class="form-control" name="searchCategory" data-size="13">
				<option value="">Tất cả danh mục</option>
				<?php
					foreach ($categoryAll as $item){
				?>
					<optgroup value="<?php echo $item['RootCategory']['id'];?>_" class="optgroup" label="<?php echo $item['RootCategory']['category_name'];?>">
					<?php
						foreach ($item['Category'] as $cat){
					?>
						<option 
							value="<?php echo $item['RootCategory']['id']."_".$cat['category_id'];?>"
							<?php 
								if(!empty($searchCategory)){
									if($searchCategory == $item['RootCategory']['id']."_".$cat['category_id']){
										echo "selected";
									};
								}
							?>
						>
							<?php echo $cat['category_name'];?>
						</option>
					<?php	
						}
					?>
					</optgroup>
				<?php
				    }
				?>
		  	</select>
		</div>
		<div class="form-group">
		  	<select class="form-control" name="searchRegion" data-size="13">
		  		<option value="">Toàn quốc</option>
				<?php
					foreach ($regionAll as $item) {
				?>
					<option 
						value="<?php echo $item['Region']['region_id'];?>"
						<?php 
							if(!empty($searchRegion)){
								if($searchRegion == $item['Region']['region_id']){
									echo "selected";
								};
							}
						?>
					>
						<?php echo $item['Region']['region_name']?>
					</option>
				<?php
					}
				?>
		  	</select>
		</div>
		<button class="btn btn-sm btn-danger btn-search" type="submit">
			<span class="glyphicon glyphicon-pencil"></span> Tìm
		</button>
		<div class="group-radio">
			<label class="radio-inline">
			  	<input type="radio" name="searchBuySell" id="radioSell" value="2"
			  		<?php 
						if(!empty($searchBuySell)){
							if($searchBuySell == POST_SELL){
								echo "checked";
							};
						}
					?>
			  	> Cần Bán
			</label>
			<label class="radio-inline">
			  	<input type="radio" name="searchBuySell" id="radioBuy" value="1"
					<?php 
						if(!empty($searchBuySell)){
							if($searchBuySell == POST_BUY){
								echo "checked";
							};
						}
					?>
			  	> Cần Mua
			</label>
		</div>
	</form>
</div>